package com.appsl.objects;

public class Option 
{
	private int type;
	private String name;
	private String[] options;
	private String message;
	private int chosen;

	public Option(int tp, String nm, String[] optn, String msg, int chs)
	{
		this.type = tp;
		this.name = nm;
		this.chosen = chs;
		this.message = msg;
		
		if (optn == null)
			this.options = null;
		else
			this.options = optn.clone();		
	}
	
	public int getType()
	{
		return type;
	}
	
	public String getName()
	{
		return name;
	}
	
	public String getCurrentOption()
	{
		if (options != null)
			return options[chosen];
		else
			return null;
	}
	
	public String[] getOptions()
	{
		return options;
	}
	
	public boolean checkIfMatch(String nm)
	{
		boolean selected = true;
		
		if (!this.name.equals(nm))
			selected = false;
		
		return selected;
	}
	
	public String getMessage()
	{
		return String.format(message, getCurrentOption());
	}
	
	public int getChosenID()
	{
		return chosen;
	}
	
	public void setSelectedID(int val)
	{
		chosen = val;
	}
}
